package com.s63.ssm.entity;

import java.util.ArrayList;
import java.util.List;

public class Page<T> {
    // 页码
    private int pageNo = 1;
    // 每页显示条数
    private int pageSize = 2;
    // 总记录数
    private int total = 0;
    // 总页数
    private int totalPages = 0;
    private List<T> list = new ArrayList<>();

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
        this.totalPages = total % pageSize == 0 ? total / pageSize : total / pageSize + 1;
    }

    public int getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
